package com.bzframework.pro.authorize.token.holder;

import com.bzframework.pro.authorize.token.parser.ParsedToken;
import com.bzframework.pro.authorize.token.parser.SimpleParsedToken;

/**
 * @Author bingzhong
 * @Date 2024/11/26 9:35
 * @Description
 */
public class TokenContextUtils {

    private TokenContextUtils() {

    }
    private static final ThreadLocal<ParsedToken> userTokenThreadLocal = ThreadLocal.withInitial(SimpleParsedToken::new);


    public static ParsedToken currentToken() {
        return userTokenThreadLocal.get();
    }
    public static void setToken(ParsedToken parsedToken) {
        userTokenThreadLocal.set(parsedToken);
    }

}
